# 构建阶段
FROM python:3.9-slim AS builder
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt -i https://pypi.doubanio.com/simple/

# 运行阶段
FROM python:3.9-slim
WORKDIR /app
COPY --from=builder /usr/local/lib/python3.9/site-packages /usr/local/lib/python3.9/site-packages
COPY repertory/.cache /root/.cache
COPY app.py .

EXPOSE 20000
CMD ["python", "app.py"]
